#ifndef M_SCENE
#define M_SCENE
#include<vector>
#include<map>
#include<memory>
#include"../header.h"
#include"../objects/object.h"
#include <accelerators/KdTreeAccel.h>
#define CORNELL_BOX 1
#define DRAGON1 2
#define FRONT_WITH_SPHERE 3
#define TEAPOT_CORNER 4
#define SSS 5
#define ENV_TEST 6
#define PTLIGHT_CORNELL 105
#define ENVLIGHT_VALLEY 106

class Scene
{
public:
	std::map<std::string, std::shared_ptr<Texture>> textures; // texture images
	std::map<std::string, Spectrum> light_map;
	std::vector<Object*> objects;
	std::unique_ptr<KdTreeAccel> kdTree;
	std::vector<Light*> lights;
	std::unique_ptr<Distribution1D> lightPowerDistribution;
	BoundingBox world_bound;
	Scene() {}
	~Scene();
	void addMeshModel(const std::string& path);
	void add_object(Object* new_obj);
	void add_light(Light* light);
	void registerLightMaterial(const string& name, const Spectrum& emission);
	void setObjectAsAreaLight(Object* pObj, const Spectrum& emission);
	bool nearest_intersect(Ray &ray_in, Float *t, SurfaceInteraction* si);
	bool intersectMedia(Ray ray_in, Float *t, SurfaceInteraction* si, Spectrum *attenuation,RandGenerator *randGen);
	void initProperties();
};


#endif // !M_SCENE
